#include "atomic_0817_phase_transition_execution_service.h"


int phaseExecService(PhaseExecInput *input, PhaseExecOutput *output)
{
    if (input == 0 || output == 0) {
        return ATOMIC_SERVICE_ERROR;
    }

    // 简单的阶段转换逻辑示例：
    // 触发信号为1时，进入下一阶段（current_phase + 1）
    // 控制指令为 100 + 下一阶段
    if (input->trigger_signal == 1) {
        output->next_phase = input->current_phase + 1;
        output->control_command = 100 + output->next_phase;
        output->return_type = ATOMIC_SERVICE_SUCCESS;
    } else {
        // 没有触发，保持原阶段
        output->next_phase = input->current_phase;
        output->control_command = 0;
        output->return_type = ATOMIC_SERVICE_FAIL;
    }

    return output->return_type;
}